#!/bin/bash
FILE=/var/log/temp-stats
# acpi-temps:
# 1-CPU, 2-Mini PCI Module, 3-HDD, 4-GPU, 5-BAT0, 6-BAT1, 7-BAT0, 9-BAT1
while true; do
 time=`date +"%s"`
 alltemps=`cat /proc/acpi/ibm/thermal`
 fan=`grep speed /proc/acpi/ibm/fan`
 cputemp=`echo $alltemps | awk '{ print $2; }'`
 temp2=`echo $alltemps | awk '{ print $3; }'`
 temp3=`echo $alltemps | awk '{ print $4; }'`
 temp4=`echo $alltemps | awk '{ print $5; }'`
 fan=`echo $fan | awk '{ print $2; }'`
# hddtemp=`hddtemp -qn /dev/hda`
# fix for my not supported hd
# hddtemp=`hddtemp -qn /dev/sda | awk '{print $3}'`
 hddtemp=`hddtemp -qn /dev/sda | python -c "import sys; print sys.stdin.read().split()[2][:-3]"`
 echo $hddtemp | grep -q sleeping >/dev/null 2>&1
 if [ $? -eq 0 ]; then hddtemp="sleeping"; fi
 echo $time $cputemp $hddtemp $temp2 $temp3 $temp4 $fan >>$FILE
 sleep 60;
done;



